package me.zhengjie.modules.houseshowconfig.domain;

import me.zhengjie.base.CommonModel;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.IdType;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import javax.validation.constraints.*;
import java.io.Serializable;
import java.util.Date;
import java.sql.Timestamp;

/**
* @author TianI
* @date 2021-12-24
*/
@Data
@Builder
@Accessors(chain = true)
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = false)
@TableName("house_show_config")
public class HouseShowConfig extends CommonModel<HouseShowConfig> implements Serializable {
    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "展示配置ID")
    @TableId(type= IdType.ASSIGN_ID)
    private Long houseShowConfigId;

    @ApiModelProperty(value = "展示ID")
    @NotNull
    private Long houseShowId;

    @ApiModelProperty(value = "场景类型： panorama 全景信息 example 样板间 roam 园林漫步")
    private String type;

    @ApiModelProperty(value = "场景名称，当场景类型为example 样板间时必填，为户型名称")
    private String name;

    @ApiModelProperty(value = "场景详情内容，在场景底部展示，可空")
    private String detail;

    @ApiModelProperty(value = "场景整体样式缩略图，在场景左上角展示，可空")
    private String previewPanorama;

    @ApiModelProperty(value = "第一个场景ID")
    private Long firstScene;

    @ApiModelProperty(value = "全景图场景切换时的持续时间,单位毫秒")
    private Integer sceneFadeDuration;

    @ApiModelProperty(value = "是否自动旋转，在加载之后，全景图会水平旋转显示，负数为往右边旋转，整数为往左边旋转，值为数字类型")
    private Integer autoRotate;

    @ApiModelProperty(value = "在autoRotate设定的情况下，用户停止操作多长时间后继续自动旋转，单位为毫秒")
    private Integer autoRotateInactivityDelay;

    @ApiModelProperty(value = "更新时间")
    @TableField(fill= FieldFill.INSERT_UPDATE)
    private Date updateTime;

    @ApiModelProperty(value = "创建时间")
    @TableField(fill= FieldFill.INSERT)
    private Date createTime;

    public void copyFrom(HouseShowConfig source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }
}
